package com.ayou.eggguard.farm.service.impl;

import com.ayou.common.utils.PageBean;
import com.ayou.eggguard.farm.mapper.FeedRecordMapper;
import com.ayou.eggguard.farm.pojo.FeedRecord;
import com.ayou.eggguard.farm.pojo.FodderRecord;
import com.ayou.eggguard.farm.service.FeedRecordService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FeedRecordServiceImpl implements FeedRecordService {

    @Autowired
    private FeedRecordMapper feedRecordMapper;

    @Override
    public PageBean<FeedRecord> getFeedRecordList(Integer pageNum, Integer pageSize,String coopNumber) {
        PageBean<FeedRecord> pb=new PageBean<>();
        PageHelper.startPage(pageNum,pageSize);
        List<FeedRecord> list=feedRecordMapper.getFeedRecordList(coopNumber);
        Page<FeedRecord> p= (Page<FeedRecord>) list;
        pb.setItems(p.getResult());
        pb.setTotal(p.getTotal());
        return pb;
    }
}
